#pragma once

#include "..\\headers.default.h"

using namespace loirey;

class CShapePattern_SingleCellInBlock
{
public:
	CRectBox<double> RatioBox;
	double Weight;
};

class CShapePatternList
{
public:
	int wAmount;
	CSimpleTypeArray<int> xL_List;
	CSimpleTypeArray<int> yL_List;
	CSimpleTypeArray<int> xH_List;
	CSimpleTypeArray<int> yH_List;
	CSimpleTypeArray<double> Weight_List;

	int PatternAmount;
	CSimpleTypeArray<int> pwlStart;
	//CSimpleTypeArray<int> pwlAmount;

public:
	static void GenGridPattern(ostream& outStream,
		double xBase, double yBase,
		double W, double H,
		int wCell, int hCell,
		int wBlkCel, int hBlkCel);
	static void GenGridPattern(
		CShapePatternList& DstSPL, bool fAppendMode,
		double xCenter, double yCenter,
		int AmountX, int AmountY,
		double wCell, double hCell,
		double xStride, double yStride,
		double Weight = 1.0);
	static void GenBlockPattern(
		CShapePatternList& DstSPL, bool fAppendMode,
		double xCenter, double yCenter,
		double wWindow, double hWindow,
		double wBlock, double hBlock,
		double xStride, double yStride,
		const CSimpleTypeArray<CShapePattern_SingleCellInBlock>& RatioCellList
		);
public:
	void Clear();
	void PushBack_SingleWindow(const CRectBox<int>& Box, double Weight);
	void PushBack_PatternFinishSign();

	void InputFromStream(istream& inStream);
	void PushBack_MultiScalePatternList_FromStream(istream& inStream);
	void OutputToStream(ostream& outStream) const;
	void LoadFromFile(string strFN_ShapePatternList);
	void SaveToFile(string strFN_ShapePatternList) const;

	int GetPattern(int*& pXL, int*& pYL, int*& pXH, int*& pYH, double*& pW, int PatternIndex) const;
};

